import { Logger } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { Log4jsLogger } from '@nestx-log4js/core';
import { AppModule } from './app.module';
import { PORT } from './config/server';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  const config = new DocumentBuilder()
    .setTitle('lookthis')
    .setDescription('The lookthis API description')
    .setVersion('1.0')
    // .addTag('lookthis')
    .build();
  const document = SwaggerModule.createDocument(app, config);
  SwaggerModule.setup('api', app, document);

  app.useLogger(app.get(Log4jsLogger));

  app.enableCors();
  await app.listen(PORT);
}
bootstrap().then(() => {
  Logger.log(`listen in http://localhost:${PORT}`);
});
